<!---->
<template>
    <div class="page_dispute">
        <common-header :title="'纠纷记录'" :showBack="true"></common-header>
        <div class="btn-save" @click="saveInfo">保存</div>
        <div class="pages-main" style="height: calc( 100vh - 45px)">
            <div class="item-info">
                <div class="item-item">
                    <datetime :min-year="1900" title="纠纷时间" placeholder="请选择纠纷时间" v-model="issuetime1"></datetime>
                </div>
            </div>
            <group title="纠纷描述">
                <x-textarea :max="200" v-model="issuedescription" placeholder="请输入纠纷描述"></x-textarea>
            </group>
            <group>
                <x-switch title="是否已调解" v-model="ismediate"></x-switch>
            </group>
        </div>
    </div>
</template>

<script>
    import resident from '../../services/resident'
    import {XSwitch, Group, Cell, XInput, Datetime, XTextarea} from 'vux'

    export default {
        name: "dispute",
        components: {
            XSwitch,
            Group,
            Cell,
            XInput,
            Datetime,
            XTextarea
        },
        data() {
            return {
                issuepersonid:this.$route.query.issuepersonid ? this.$route.query.issuepersonid: '',
                id:this.$route.query.id  ? this.$route.query.id: '',
                issuetime1: this.$route.query.issuetime ? this.$route.query.issuetime : '',
                issuedescription: this.$route.query.issuedescription ? this.$route.query.issuedescription : '',
                ismediate: this.$route.query.ismediate ? true : false,
            }
        },

        created() {

        },
        watch: {},
        methods: {
            // 保存纠纷记录
            saveInfo() {
                if (!this.issuetime1) {
                    this.$vux.toast.show({
                        text: '请选择纠纷时间',
                        type: 'text',
                        position: 'middle',
                    })
                    return;
                }
                if (!this.issuedescription) {
                    this.$vux.toast.show({
                        text: '请填写纠纷描述',
                        type: 'text',
                        position: 'middle',
                    })
                    return;
                }
                let _param = this.$tools.invokeUAF('resident/saveIssueInfo', {
                    id:this.id,
                    issuepersonid:this.issuepersonid,
                    issuetime:  this.issuetime1 + ' ' + '00:00:00',
                    issuedescription: this.issuedescription,
                    ismediate: this.ismediate ? 1 : 0,
                })
                resident.saveIssueInfo(_param).then(res => {
                    let data = res.data.data;
                })
            },
        },
    };
</script>

<style lang="less" rel="stylesheet/less" type="text/less">
    .page_dispute {
    }
</style>
